// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#include <iostream>

#include "../CppUnitLite/TestHarness.h"

#include "../Constants.h"
#include "../Angle.h"

using namespace std;

// The test suite needs to generate strings from vectors
SimpleString StringFrom(Angle const& value)
{
	return SimpleString(value.toString().c_str());
}


TEST(FromGameStudio, Angle) {
	ANGLE a = {_VAR(90), _VAR(75), _VAR(0) };
	Angle b(&a);
	CHECK_EQUAL(
		Angle(M_PI / 2.0, M_PI / 180.0 * 75.0, 0.0),
		b);
}

TEST(ToGameStudio, Angle) {
	ANGLE a1 = {0, 0, 0};
	ANGLE a2 = {0, 0, 0};
	Angle b(M_PI / 2.0, M_PI / 180.0 * 75.0, 0.0);
	b.toGamestudio(&a1);
	b.toGamestudio((ANGLE*)&a2.pan);

	CHECK_EQUAL(_VAR(90), a1.pan);
	CHECK_EQUAL(_VAR(75), a1.tilt);
	CHECK_EQUAL(_VAR(0), a1.roll);
	CHECK_EQUAL(_VAR(90), a2.pan);
	CHECK_EQUAL(_VAR(75), a2.tilt);
	CHECK_EQUAL(_VAR(0), a2.roll);
}